//
//  WinConditionsSprite.m
//  CandyCrushClone
//
//  Created by Petar on 4/26/15.
//  Copyright (c) 2015 Nestorov Engineering. All rights reserved.
//

#import "WinConditionsSprite.h"
#import "SKTUtils.h"

@implementation WinConditionsSprite


- (instancetype)initWithConditions:(NSDictionary *)gameWinConditions
{
    
    if ( self = [super initWithImageNamed:@"winConditiones"] ) {
        
        _cookieType1Label = [self labelWithText:[NSString stringWithFormat:@"%@",gameWinConditions[@"1"]] atPosition:CGPointMake(-92, -57)];
        _cookieType2Label = [self labelWithText:[NSString stringWithFormat:@"%@",gameWinConditions[@"2"]] atPosition:CGPointMake(-33, -57)];
        _cookieType3Label = [self labelWithText:[NSString stringWithFormat:@"%@",gameWinConditions[@"3"]]  atPosition:CGPointMake(30, -57)];
        _cookieType4Label = [self labelWithText:[NSString stringWithFormat:@"%@",gameWinConditions[@"4"]]  atPosition:CGPointMake(90, -57)];
        
    }
    
    return self;
    
}


#pragma mark - Helper Methods

- (SKLabelNode *)labelWithText:(NSString *)text atPosition:(CGPoint)position
{
    
    SKLabelNode *label = [SKLabelNode labelNodeWithFontNamed:@"GillSans-BoldItalic"];
    label.fontColor = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:164.0/255.0 alpha:1];
    label.fontSize = 25;
    label.text = text;
    label.position = position;
    
    [self addChild:label];
    
    return label;
    
}


@end
